{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0b54c3b1",
   "metadata": {},
   "source": [
    "# Programmable Web需求关键词视角下调用记录分析报告"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e4e03656",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import os\n",
    "import re\n",
    "from scipy.stats import chi2_contingency\n",
    "import seaborn\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "54c9cb59",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_dataframe(path):  # 解析csv文件\n",
    "    columns=[]\n",
    "    data=[]\n",
    "    with open(path,\"r\",encoding=\"utf-8\") as f:\n",
    "        for i,line in enumerate(f.readlines()):#对文件内容进行遍历\n",
    "            line_split=line.strip().split(\"\\t\")\n",
    "            if i==0:\n",
    "                columns=line_split\n",
    "            else:\n",
    "                data.append(line_split)\n",
    "\n",
    "    data=pd.DataFrame(data,columns=columns)\n",
    "    return data\n",
    "\n",
    "def get_styles():  # 获得API与web API的服务接口协议的对应关系\n",
    "    urls=[]\n",
    "    styles=[]\n",
    "    i,j=0,0\n",
    "    with open(\"D:\\\\active_apis_data.txt\",\"r\") as f:\n",
    "        for line in f.readlines():\n",
    "            line_split=line.strip().replace('\"',\"\").split(\":\")\n",
    "            if 'url' in line_split and i==j:\n",
    "                urls.append(line_split[-1].strip().replace(\"\\\\n\",\"\").replace(\",\",\"\"))\n",
    "                i+=1\n",
    "            if 'style' in line_split and i-j==1:\n",
    "                styles.append(line_split[-1].strip().replace(\",\",\"\"))\n",
    "                j+=1\n",
    "        data=pd.DataFrame(np.concatenate([np.expand_dims(np.array(urls),axis=-1),\n",
    "                                          np.expand_dims(np.array(styles),axis=-1)],axis=-1),columns=[\"url\",\"style\"])\n",
    "        return data"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "980b7af3",
   "metadata": {},
   "source": [
    "## 1 统计"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e5e3ef41",
   "metadata": {},
   "source": [
    "### 1.1 统计 Mashup中的包含Web API个数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "f5086656",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Mashup</th>\n",
       "      <th>API counts</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Mashup: We-Wired Web</td>\n",
       "      <td>37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Mashup: DoAt (do@)</td>\n",
       "      <td>29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Mashup: Pixelpipe</td>\n",
       "      <td>28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Mashup: Sociotoco Search</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Mashup: Gawkk.com</td>\n",
       "      <td>23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6066</th>\n",
       "      <td>Mashup: LocalUncle</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6067</th>\n",
       "      <td>Mashup: Localetrends</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6068</th>\n",
       "      <td>Mashup: Localpha</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6069</th>\n",
       "      <td>Mashup: Locate Colleges in California on the Map</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6070</th>\n",
       "      <td>Mashup: zangoa</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>6071 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                Mashup  API counts\n",
       "0                                 Mashup: We-Wired Web          37\n",
       "1                                   Mashup: DoAt (do@)          29\n",
       "2                                    Mashup: Pixelpipe          28\n",
       "3                             Mashup: Sociotoco Search          24\n",
       "4                                    Mashup: Gawkk.com          23\n",
       "...                                                ...         ...\n",
       "6066                                Mashup: LocalUncle           1\n",
       "6067                              Mashup: Localetrends           1\n",
       "6068                                  Mashup: Localpha           1\n",
       "6069  Mashup: Locate Colleges in California on the Map           1\n",
       "6070                                    Mashup: zangoa           1\n",
       "\n",
       "[6071 rows x 2 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_ma=get_dataframe(path=\"D:\\\\m-a_edges.csv\")\n",
    "mashup_count=data_ma.groupby(\"source\").count().reset_index()\n",
    "mashup_count.columns=[\"Mashup\",\"API counts\"]\n",
    "mashup_count.sort_values(by=\"API counts\",ascending = False).reset_index(drop=True)#按照包含API数目降序排序"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e2bd67c2",
   "metadata": {},
   "source": [
    "### 1.2 Web API被使用的次数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "25ca403b",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>API</th>\n",
       "      <th>referred counts</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>/api/google-maps</td>\n",
       "      <td>1984</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>/api/twitter</td>\n",
       "      <td>671</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>/api/youtube</td>\n",
       "      <td>562</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>/api/flickr</td>\n",
       "      <td>474</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>/api/facebook</td>\n",
       "      <td>381</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1503</th>\n",
       "      <td>/api/mydigitalstructure</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1504</th>\n",
       "      <td>/api/mymemory</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1505</th>\n",
       "      <td>/api/mynetdiary-food-search</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1506</th>\n",
       "      <td>/api/clickup</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1507</th>\n",
       "      <td>/api/123-shop-pro</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1508 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                              API  referred counts\n",
       "0                /api/google-maps             1984\n",
       "1                    /api/twitter              671\n",
       "2                    /api/youtube              562\n",
       "3                     /api/flickr              474\n",
       "4                   /api/facebook              381\n",
       "...                           ...              ...\n",
       "1503      /api/mydigitalstructure                1\n",
       "1504                /api/mymemory                1\n",
       "1505  /api/mynetdiary-food-search                1\n",
       "1506                 /api/clickup                1\n",
       "1507            /api/123-shop-pro                1\n",
       "\n",
       "[1508 rows x 2 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "api_counts=data_ma.groupby(\"target\").count().reset_index()\n",
    "api_counts.columns=[\"API\",\"referred counts\"]\n",
    "api_counts.sort_values(by=\"referred counts\",ascending = False).reset_index(drop=True)#按照API使用次数降序排序"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "642f75cf",
   "metadata": {},
   "source": [
    "### 1.3 Web API提供商发布Web API的个数。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "006dba5c",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>api producer</th>\n",
       "      <th>counts</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>//twitter.com/</td>\n",
       "      <td>13690</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>//github.com/</td>\n",
       "      <td>1436</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>//intrinio.com/</td>\n",
       "      <td>160</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>//rapidapi.com/</td>\n",
       "      <td>105</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>//getsatisfaction.com/</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2652</th>\n",
       "      <td>//minebans.com/</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2653</th>\n",
       "      <td>//freecode.com/</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2654</th>\n",
       "      <td>//sosedoff.com/</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2655</th>\n",
       "      <td>//tickspot.com/</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2656</th>\n",
       "      <td>//rtckit.com/</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2657 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                api producer  counts\n",
       "0             //twitter.com/   13690\n",
       "1              //github.com/    1436\n",
       "2            //intrinio.com/     160\n",
       "3            //rapidapi.com/     105\n",
       "4     //getsatisfaction.com/      73\n",
       "...                      ...     ...\n",
       "2652         //minebans.com/       0\n",
       "2653         //freecode.com/       0\n",
       "2654         //sosedoff.com/       0\n",
       "2655         //tickspot.com/       0\n",
       "2656           //rtckit.com/       0\n",
       "\n",
       "[2657 rows x 2 columns]"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "visit_urls={}\n",
    "root=\"D:\\\\api_accessibility\"\n",
    "filenames=os.listdir(root)\n",
    "apis=[]\n",
    "for filename in filenames:\n",
    "    path=root+\"/\"+filename\n",
    "    with open(path,\"r\") as f:\n",
    "        cur_producer=None\n",
    "        for i,line in enumerate(f.readlines()):\n",
    "            if re.search('\"visit_url\"',line.strip()) is not None:\n",
    "                # reg=\"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+\"\n",
    "                reg=\"//[a-zA-Z]+.com/\"#供应商对应的正则表达式\n",
    "                if re.search(reg,line.strip()) is not None:#按照reg模式匹配visit_url的内容\n",
    "                    api=re.search(reg,line.strip()).group()\n",
    "                    if api not in apis:\n",
    "                        visit_urls[api] = []\n",
    "                        apis.append(api)\n",
    "                    cur_producer=api\n",
    "            if re.search('\"url\"',line.strip()) is not None:\n",
    "                if cur_producer is not None:\n",
    "                    url_producer=line.strip()[8:-3]\n",
    "                    visit_urls[cur_producer].append(url_producer)\n",
    "url_producer_count=sorted([(k,len(set(v))) for k,v in visit_urls.items()],key=lambda x:x[1],reverse=True)\n",
    "df=pd.DataFrame(url_producer_count,columns=[\"api producer\",\"counts\"])\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f01b55e9",
   "metadata": {},
   "source": [
    "## 2.从需求关键词视角，分析在不同标注或Category类别中， 编程开发人员的组合需求（Mashup）与该需求所调用的服务（Web API）的关联情况。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "15872fae",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\lenovo\\anaconda3\\lib\\site-packages\\seaborn\\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAABIgAAAI/CAYAAAAcM+I0AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAwRUlEQVR4nO3de7xtZV0v/s9XtohXUNmacgkyzMiUFMm7dDJDrYikhLyEJyM63jv9Tpzf8Sipr8q09JAXDnIQLZWTAoZKoqmIF0xAkJuihBiIKaaZtzTwOX+MsdiTtedaa+7NXGvtvZ/3+/Xarz3mmGPO+cxnPvMZz/yMZ4xVrbUAAAAA0K/brHcBAAAAAFhfAiIAAACAzgmIAAAAADonIAIAAADonIAIAAAAoHMCIgAAAIDObVivF959993bPvvss14vDwAAALDDufDCC7/WWtu4pY9bt4Bon332yQUXXLBeLw8AAACww6mqL27N45xiBgAAANA5AREAAABA5wREAAAAAJ0TEAEAAAB0TkAEAAAA0DkBEQAAAEDnBEQAAAAAnRMQAQAAAHROQAQAAADQOQERAAAAQOcERAAAAACdExABAAAAdE5ABAAAANA5AREAAABA5wREAAAAAJ0TEAEAAAB0TkAEAAAA0DkBEQAAAEDnBEQAAAAAnRMQAQAAAHRuxYCoqk6uqq9W1WVL3F9VdXxVXVVVl1TVg+ZfTAAAAABWyywziE5Jcsgy9z8+yX7jv6OTvP7WFwsAAACAtbJiQNRaOzfJ15fZ5NAkb26DTyTZraruNa8CAgAAALC65nENoj2SXDtx+7pxHQAAAADbgQ1zeI6asq5N3bDq6AynoWXvvfde9klveP1f3+qCbS82/t5Tt/qx17/29+dYkm3fvZ/1F1v1uPNO/KU5l2Tb9rCj373Vj33HG5c7o3THcvgz3rvVjz3+Lb84x5Js+577lLPXuwgAAMAqmscMouuS7DVxe88k10/bsLV2YmvtwNbagRs3bpzDSwMAAABwa80jIDozydPHv2b20CTfbK19eQ7PCwA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7Yz1Lhesthr+OumrWmuPWnFjYLtTwzV1dm2t/c/1LgtbZkeZQQSw3aqqYzJMK3/+OheF6X6nqn4rw4X9LsrwZ+ZhHo6rqsdmuH7C+zJcnBx2aONsgN/L5qfbATuAqjojwyzy7ekaVozMIAIAAADo3A53kWoAAAAAtoyACAAAAKBzAiIAAACAzgmIAAAAADonIAIAAADonIAIAAAAoHP/D6Eh5UxkyJsbAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 1440x720 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "data_ma=get_dataframe(path=\"m-a_edges.csv\")\n",
    "data_ma.columns=[\"name\",\"target\"]\n",
    "data_mashup=get_dataframe(path=\"mashup_nodes_estimator.csv\")\n",
    "data_ma_new=pd.merge(data_ma,data_mashup,on=\"name\")#name作为主键字段，将两个表合并\n",
    "data=data_ma_new[[\"name\",\"target\",\"c\"]].sort_values(\"c\").reset_index(drop=True)\n",
    "data[\"concat\"]=data[\"name\"]+\"==\"+data[\"target\"]\n",
    "data\n",
    "ps=[]#ps储存P值\n",
    "cs=[]#ps储存类别名称\n",
    "for c,group in data.groupby(\"c\"):\n",
    "    cs.append(c)\n",
    "    mashup=np.unique(group[\"name\"])\n",
    "    api=np.unique(group[\"target\"])\n",
    "    df=pd.DataFrame(np.zeros((len(mashup),len(api))),index=mashup,columns=api)#创建一个列联表，规格为len(mashup)乘len(api)，值为1说明该API参与组成了该Mashup\n",
    "    concat=np.array(group[\"concat\"])\n",
    "    for line in concat:\n",
    "        m,a=line.split(\"==\")\n",
    "        df.loc[m,a]+=1\n",
    "    p=chi2_contingency(df)#得到列联表的卡方检验结果\n",
    "    ps.append(p[1])#p值\n",
    "ps=np.array(ps)\n",
    "cs=np.array(cs)\n",
    "plt.figure(figsize=(20,10))\n",
    "index_rand=np.random.choice(range(len(cs)),15)  #在所有类别中选15个类别\n",
    "cs,ps=cs[index_rand],ps[index_rand]\n",
    "index_sort=np.argsort(ps)[::-1]\n",
    "ps=ps[index_sort]\n",
    "cs=cs[index_sort]\n",
    "seaborn.barplot(cs,ps)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "01306058",
   "metadata": {},
   "source": [
    "## 3.从非功能视角（例如API之间的兼容性，Web API不同的服务接口协议REST、RPC），对于相同标注下的Web API，非功能不同对于参与服务组合的情况统计。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "177da216",
   "metadata": {},
   "source": [
    "### 3.1 从API兼容性角度"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "a052ba22",
   "metadata": {},
   "outputs": [],
   "source": [
    "data_ma=get_dataframe(\"D:\\\\m-a_edges.csv\")\n",
    "data_ma.rename(columns={'target':\"url\"},inplace=True)\n",
    "data_api=get_dataframe(\"D:\\\\api_nodes_estimator.csv\")\n",
    "data_ma\n",
    "data_ma_c=pd.merge(data_ma,data_api,on=\"url\",how=\"left\")[[\"source\",\"url\",\"c\"]].dropna(axis=0)#添加data_ma表中的api数据对应的类别数据\n",
    "data_ma_c_conn=pd.merge(data_ma_c,data_ma_c,on=\"c\",how=\"outer\")\n",
    "data_ma_c_conn=data_ma_c_conn[data_ma_c_conn[\"url_x\"]!=data_ma_c_conn[\"url_y\"]]\n",
    "data_ma_c_conn=data_ma_c_conn[data_ma_c_conn[\"source_x\"]==data_ma_c_conn[\"source_y\"]]#将同一类别的两个不同API建立联系\n",
    "results=data_ma_c_conn.groupby(by=[\"c\",\"url_x\",\"url_y\"])[\"source_x\"].count().reset_index().sort_values(\"source_x\",ascending=False)\n",
    "results.columns=[\"c\",\"API_1\",\"API_2\",\"mashup_counts\"]\n",
    "results.to_csv(\"D:\\\\关于api兼容性的数据结果.csv\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ca460460",
   "metadata": {},
   "source": [
    "### 3.2 从服务接口协议角度"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "0c09f265",
   "metadata": {},
   "outputs": [],
   "source": [
    "data_ma=get_dataframe(\"D:\\\\m-a_edges.csv\")\n",
    "data_ma.rename(columns={'target':\"url\"},inplace=True)\n",
    "data_api=get_dataframe(\"D:\\\\api_nodes_estimator.csv\")\n",
    "data_ma\n",
    "data_ma_c=pd.merge(data_ma,data_api,on=\"url\",how=\"left\")[[\"source\",\"url\",\"c\"]].dropna(axis=0)\n",
    "data_ma_c_conn=pd.merge(data_ma_c,data_ma_c,on=\"c\",how=\"outer\")\n",
    "data_ma_c_conn=data_ma_c_conn[data_ma_c_conn[\"url_x\"]!=data_ma_c_conn[\"url_y\"]]\n",
    "data_ma_c_conn=data_ma_c_conn[data_ma_c_conn[\"source_x\"]==data_ma_c_conn[\"source_y\"]]\n",
    "results=data_ma_c_conn.groupby(by=[\"c\",\"url_x\",\"url_y\"])[\"source_x\"].count().reset_index().sort_values(\"source_x\",ascending=False)\n",
    "results.columns=[\"c\",\"API_1\",\"API_2\",\"mashup_counts\"]\n",
    "results.to_csv(\"D:\\\\apijianrong.csv\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "84a8fb16",
   "metadata": {},
   "source": [
    "## 报告中所需的其他数据分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "85961dec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>style</th>\n",
       "      <th>url</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>EMAIL/MESSAGING/FTP</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Native/Browser</td>\n",
       "      <td>179</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>FEED</td>\n",
       "      <td>209</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Unspecified</td>\n",
       "      <td>310</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Streaming</td>\n",
       "      <td>369</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Indirect</td>\n",
       "      <td>371</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>RPC</td>\n",
       "      <td>1890</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>REST</td>\n",
       "      <td>18199</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 style    url\n",
       "0  EMAIL/MESSAGING/FTP     39\n",
       "1       Native/Browser    179\n",
       "2                 FEED    209\n",
       "3          Unspecified    310\n",
       "4            Streaming    369\n",
       "5             Indirect    371\n",
       "6                  RPC   1890\n",
       "7                 REST  18199"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_sty=get_styles()\n",
    "sty_count=df_sty.groupby(\"style\").count().sort_values(\"url\").reset_index()\n",
    "sty_count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "4983472b",
   "metadata": {},
   "outputs": [],
   "source": [
    "data_mashup=get_dataframe(\"mashup_nodes_estimator.csv\")[[\"name\",\"c\"]]\n",
    "data_mashup.columns=[\"mashup\",\"c\"]\n",
    "data_mashup.to_csv(\"D:\\\\mashup具体.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "afc4970b",
   "metadata": {},
   "outputs": [],
   "source": [
    "mashup_count=data_mashup.groupby(\"c\").count().sort_values(by=\"mashup\",ascending=False).reset_index()\n",
    "mashup_count.to_csv(\"D:\\\\mashup分类统计.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "20ae8190",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tp</th>\n",
       "      <th>url</th>\n",
       "      <th>name</th>\n",
       "      <th>st</th>\n",
       "      <th>et</th>\n",
       "      <th>oet</th>\n",
       "      <th>c</th>\n",
       "      <th>oac</th>\n",
       "      <th>ac</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>api</td>\n",
       "      <td>/api/pinnaclecart-rest</td>\n",
       "      <td>PinnacleCart REST API MASTER RECORD</td>\n",
       "      <td>2011-01-25</td>\n",
       "      <td>2014-11-04</td>\n",
       "      <td>2222-02-22</td>\n",
       "      <td>eCommerce</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>api</td>\n",
       "      <td>/api/volusion-shopping-cart</td>\n",
       "      <td>Volusion Shopping Cart API MASTER RECORD</td>\n",
       "      <td>2012-06-14</td>\n",
       "      <td>2014-09-14</td>\n",
       "      <td>2222-02-22</td>\n",
       "      <td>eCommerce</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>api</td>\n",
       "      <td>/api/untappd</td>\n",
       "      <td>Untappd API MASTER RECORD</td>\n",
       "      <td>2010-12-21</td>\n",
       "      <td>2222-02-22</td>\n",
       "      <td>2222-02-22</td>\n",
       "      <td>Food</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>api</td>\n",
       "      <td>/api/envato</td>\n",
       "      <td>Envato API MASTER RECORD</td>\n",
       "      <td>2011-03-02</td>\n",
       "      <td>2019-06-05</td>\n",
       "      <td>2222-02-22</td>\n",
       "      <td>eCommerce</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>api</td>\n",
       "      <td>/api/edrv-ev-charging</td>\n",
       "      <td>eDRV EV Charging API MASTER RECORD</td>\n",
       "      <td>2020-07-29</td>\n",
       "      <td>2020-07-31</td>\n",
       "      <td>2222-02-22</td>\n",
       "      <td>Energy</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23574</th>\n",
       "      <td>api</td>\n",
       "      <td>/api/dropbox-sync</td>\n",
       "      <td>Dropbox Sync API MASTER RECORD</td>\n",
       "      <td>2014-09-21</td>\n",
       "      <td>2017-01-17</td>\n",
       "      <td>2015-10-07</td>\n",
       "      <td>Syncing</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23575</th>\n",
       "      <td>api</td>\n",
       "      <td>/api/kratia</td>\n",
       "      <td>Kratia API MASTER RECORD</td>\n",
       "      <td>2006-02-03</td>\n",
       "      <td>2012-08-23</td>\n",
       "      <td>2014-04-19</td>\n",
       "      <td>Search</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23576</th>\n",
       "      <td>api</td>\n",
       "      <td>/api/messagemost</td>\n",
       "      <td>MessageMost API MASTER RECORD</td>\n",
       "      <td>2009-12-23</td>\n",
       "      <td>2016-09-30</td>\n",
       "      <td>2014-04-19</td>\n",
       "      <td>Social</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23577</th>\n",
       "      <td>api</td>\n",
       "      <td>/api/sec-watch</td>\n",
       "      <td>SEC Watch API MASTER RECORD</td>\n",
       "      <td>2009-01-27</td>\n",
       "      <td>2014-02-10</td>\n",
       "      <td>2014-04-19</td>\n",
       "      <td>Financial</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23578</th>\n",
       "      <td>api</td>\n",
       "      <td>/api/answerbag</td>\n",
       "      <td>Answerbag API MASTER RECORD</td>\n",
       "      <td>2007-02-15</td>\n",
       "      <td>2013-05-26</td>\n",
       "      <td>2014-04-19</td>\n",
       "      <td>Q&amp;A</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>23579 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        tp                          url  \\\n",
       "0      api       /api/pinnaclecart-rest   \n",
       "1      api  /api/volusion-shopping-cart   \n",
       "2      api                 /api/untappd   \n",
       "3      api                  /api/envato   \n",
       "4      api        /api/edrv-ev-charging   \n",
       "...    ...                          ...   \n",
       "23574  api            /api/dropbox-sync   \n",
       "23575  api                  /api/kratia   \n",
       "23576  api             /api/messagemost   \n",
       "23577  api               /api/sec-watch   \n",
       "23578  api               /api/answerbag   \n",
       "\n",
       "                                           name          st          et  \\\n",
       "0           PinnacleCart REST API MASTER RECORD  2011-01-25  2014-11-04   \n",
       "1      Volusion Shopping Cart API MASTER RECORD  2012-06-14  2014-09-14   \n",
       "2                     Untappd API MASTER RECORD  2010-12-21  2222-02-22   \n",
       "3                      Envato API MASTER RECORD  2011-03-02  2019-06-05   \n",
       "4            eDRV EV Charging API MASTER RECORD  2020-07-29  2020-07-31   \n",
       "...                                         ...         ...         ...   \n",
       "23574            Dropbox Sync API MASTER RECORD  2014-09-21  2017-01-17   \n",
       "23575                  Kratia API MASTER RECORD  2006-02-03  2012-08-23   \n",
       "23576             MessageMost API MASTER RECORD  2009-12-23  2016-09-30   \n",
       "23577               SEC Watch API MASTER RECORD  2009-01-27  2014-02-10   \n",
       "23578               Answerbag API MASTER RECORD  2007-02-15  2013-05-26   \n",
       "\n",
       "              oet          c    oac     ac  \n",
       "0      2222-02-22  eCommerce   True  False  \n",
       "1      2222-02-22  eCommerce   True  False  \n",
       "2      2222-02-22       Food   True   True  \n",
       "3      2222-02-22  eCommerce   True  False  \n",
       "4      2222-02-22     Energy   True  False  \n",
       "...           ...        ...    ...    ...  \n",
       "23574  2015-10-07    Syncing  False  False  \n",
       "23575  2014-04-19     Search  False  False  \n",
       "23576  2014-04-19     Social  False  False  \n",
       "23577  2014-04-19  Financial  False  False  \n",
       "23578  2014-04-19        Q&A  False  False  \n",
       "\n",
       "[23579 rows x 9 columns]"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_api=get_dataframe(path=\"D:\\\\api_nodes_estimator.csv\")\n",
    "data_api"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "08e4f639",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>source</th>\n",
       "      <th>target</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Mashup: CouponRoots</td>\n",
       "      <td>/api/coupon</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Mashup: Raise the Money</td>\n",
       "      <td>/api/nationbuilder</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Mashup: AnythingToHTML</td>\n",
       "      <td>/api/hpe-haven-ondemand-view-document</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Mashup: Velocipedia</td>\n",
       "      <td>/api/mapbox</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Mashup: Api Expert - MyMemory Language Translator</td>\n",
       "      <td>/api/mymemory</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12609</th>\n",
       "      <td>Mashup: Libraries411</td>\n",
       "      <td>/api/geocoder</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12610</th>\n",
       "      <td>Mashup: Libraries411</td>\n",
       "      <td>/api/geocoderca</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12611</th>\n",
       "      <td>Mashup: National Geographic Map Machine</td>\n",
       "      <td>/api/globexplorer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12612</th>\n",
       "      <td>Mashup: Splashr</td>\n",
       "      <td>/api/flickr</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12613</th>\n",
       "      <td>Mashup: Smarkets</td>\n",
       "      <td>/api/amazon-product-advertising</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>12614 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                  source  \\\n",
       "0                                    Mashup: CouponRoots   \n",
       "1                                Mashup: Raise the Money   \n",
       "2                                 Mashup: AnythingToHTML   \n",
       "3                                    Mashup: Velocipedia   \n",
       "4      Mashup: Api Expert - MyMemory Language Translator   \n",
       "...                                                  ...   \n",
       "12609                               Mashup: Libraries411   \n",
       "12610                               Mashup: Libraries411   \n",
       "12611            Mashup: National Geographic Map Machine   \n",
       "12612                                    Mashup: Splashr   \n",
       "12613                                   Mashup: Smarkets   \n",
       "\n",
       "                                      target  \n",
       "0                                /api/coupon  \n",
       "1                         /api/nationbuilder  \n",
       "2      /api/hpe-haven-ondemand-view-document  \n",
       "3                                /api/mapbox  \n",
       "4                              /api/mymemory  \n",
       "...                                      ...  \n",
       "12609                          /api/geocoder  \n",
       "12610                        /api/geocoderca  \n",
       "12611                      /api/globexplorer  \n",
       "12612                            /api/flickr  \n",
       "12613        /api/amazon-product-advertising  \n",
       "\n",
       "[12614 rows x 2 columns]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_ma=get_dataframe(path=\"D:\\\\m-a_edges.csv\")\n",
    "data_ma"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "1da3105d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>target</th>\n",
       "      <th>source</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>/api/google-maps</td>\n",
       "      <td>1984</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>/api/twitter</td>\n",
       "      <td>671</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>/api/youtube</td>\n",
       "      <td>562</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>/api/flickr</td>\n",
       "      <td>474</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>/api/facebook</td>\n",
       "      <td>381</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1503</th>\n",
       "      <td>/api/mydigitalstructure</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1504</th>\n",
       "      <td>/api/mymemory</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1505</th>\n",
       "      <td>/api/mynetdiary-food-search</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1506</th>\n",
       "      <td>/api/clickup</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1507</th>\n",
       "      <td>/api/123-shop-pro</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1508 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                           target  source\n",
       "0                /api/google-maps    1984\n",
       "1                    /api/twitter     671\n",
       "2                    /api/youtube     562\n",
       "3                     /api/flickr     474\n",
       "4                   /api/facebook     381\n",
       "...                           ...     ...\n",
       "1503      /api/mydigitalstructure       1\n",
       "1504                /api/mymemory       1\n",
       "1505  /api/mynetdiary-food-search       1\n",
       "1506                 /api/clickup       1\n",
       "1507            /api/123-shop-pro       1\n",
       "\n",
       "[1508 rows x 2 columns]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "m_a_count=data_ma.groupby(\"target\").count().sort_values(by=\"source\",ascending=False).reset_index()\n",
    "m_a_count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "00febb14",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>api</th>\n",
       "      <th>c</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>/api/pinnaclecart-rest</td>\n",
       "      <td>eCommerce</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>/api/volusion-shopping-cart</td>\n",
       "      <td>eCommerce</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>/api/untappd</td>\n",
       "      <td>Food</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>/api/envato</td>\n",
       "      <td>eCommerce</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>/api/edrv-ev-charging</td>\n",
       "      <td>Energy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23574</th>\n",
       "      <td>/api/dropbox-sync</td>\n",
       "      <td>Syncing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23575</th>\n",
       "      <td>/api/kratia</td>\n",
       "      <td>Search</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23576</th>\n",
       "      <td>/api/messagemost</td>\n",
       "      <td>Social</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23577</th>\n",
       "      <td>/api/sec-watch</td>\n",
       "      <td>Financial</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23578</th>\n",
       "      <td>/api/answerbag</td>\n",
       "      <td>Q&amp;A</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>23579 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                               api          c\n",
       "0           /api/pinnaclecart-rest  eCommerce\n",
       "1      /api/volusion-shopping-cart  eCommerce\n",
       "2                     /api/untappd       Food\n",
       "3                      /api/envato  eCommerce\n",
       "4            /api/edrv-ev-charging     Energy\n",
       "...                            ...        ...\n",
       "23574            /api/dropbox-sync    Syncing\n",
       "23575                  /api/kratia     Search\n",
       "23576             /api/messagemost     Social\n",
       "23577               /api/sec-watch  Financial\n",
       "23578               /api/answerbag        Q&A\n",
       "\n",
       "[23579 rows x 2 columns]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_api=get_dataframe(\"api_nodes_estimator.csv\")[[\"url\",\"c\"]]\n",
    "data_api.columns=[\"api\",\"c\"]\n",
    "data_api"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "18195e5e",
   "metadata": {},
   "outputs": [],
   "source": [
    "api_count=data_api.groupby(\"c\").count().sort_values(by=\"api\",ascending=False).reset_index()\n",
    "api_count.to_csv(\"D:\\\\api分类统计.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "aaddac57",
   "metadata": {},
   "outputs": [],
   "source": [
    "data_api=get_dataframe(path=\"D:\\\\api_nodes_estimator.csv\")\n",
    "data_api.to_csv(\"D:\\\\api111分类统计.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "5849c395",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.7595623997054235 3D\n",
      "0.3531649328512703 API\n",
      "1.0 API Management\n",
      "1.0 Accessibility\n",
      "0.3656592502219386 Accounting\n",
      "1.0 Accounts\n",
      "1.0 Activity Streams\n",
      "1.0 Addresses\n",
      "0.23810330555354436 Adult\n",
      "0.9178086996747276 Advertising\n",
      "1.0 African\n",
      "0.9318380883043561 Aggregation\n",
      "0.8707057169180207 Air Travel\n",
      "1.0 Algorithms\n",
      "0.8651512112804953 Analytics\n",
      "0.4717716161087487 Animals\n",
      "0.9999945768568219 Application Development\n",
      "0.25591260154408896 Applications\n",
      "0.9966843482116237 Art\n",
      "0.22313016014842973 Artificial Intelligence\n",
      "1.0 Asia\n",
      "0.22313016014842982 Astrology\n",
      "0.3255499377506354 Astronomy\n",
      "1.0 Auctions\n",
      "0.3125333661009496 Audio\n",
      "0.8130549999084319 Australian\n",
      "0.8515649321549962 Auto\n",
      "1.0 Automation\n",
      "1.0 Avatars\n",
      "1.0 Background\n",
      "1.0 Backup\n",
      "0.6949629742611338 Bars\n",
      "0.3044531593776482 Beer\n",
      "1.0 Belgian\n",
      "1.0 Big Data\n",
      "0.9829142423606629 Bitcoin\n",
      "1.0 Blockchain\n",
      "1.0 Blogging\n",
      "0.6919374325914801 Boating\n",
      "0.9895895349108693 Booking\n",
      "1.0 Bookmarks\n",
      "0.9818834555803864 Books\n",
      "0.5438131158833297 Bots\n",
      "0.2589612561135274 Brazilian\n",
      "1.0 Breweries\n",
      "1.0 Browsers\n",
      "0.271525416412083 Business\n",
      "0.9873753711133785 Calendars\n",
      "0.26502591529736164 Campaigns\n",
      "0.9999878181520637 Canadian\n",
      "1.0 Catalogs\n",
      "0.36768468852884306 Celebrities\n",
      "0.8758736041911409 Charity\n",
      "0.9457286866803459 Charts\n",
      "0.380332466613976 Chat\n",
      "1.0 Check-In\n",
      "0.5486891659888844 Chinese\n",
      "1.0 Cities\n",
      "0.39341132977355264 Classification\n",
      "0.789360104859043 Classifieds\n",
      "1.0 Clothing\n",
      "0.6043493604981536 Cloud\n",
      "0.21330930508341653 Collaboration\n",
      "1.0 Collecting\n",
      "0.6244094460837422 Colors\n",
      "1.0 Community\n",
      "0.7568703570557385 Comparisons\n",
      "0.8901766611914054 Contacts\n",
      "0.22313016014842973 Content\n",
      "0.33281967875071855 Content Management\n",
      "1.0 Conversions\n",
      "1.0 Copyright\n",
      "1.0 Coronavirus\n",
      "1.0 Countries\n",
      "0.27746213345928716 Coupons\n",
      "0.22313016014842982 Credit Cards\n",
      "0.999119437531761 Crime\n",
      "0.29702839792467406 Cryptocurrency\n",
      "1.0 Currency\n",
      "0.2822363544462913 Customer Relationship Management\n",
      "0.22313016014842973 Customer Service\n",
      "0.982862866938095 Cycling\n",
      "1.0 Dashboards\n",
      "0.5601522385534954 Data\n",
      "1.0 Data Mining\n",
      "0.7746058085771984 Database\n",
      "1.0 Database-as-a-Service\n",
      "0.42803213649442823 Dating\n",
      "0.26266556067232216 Demographics\n",
      "0.3999308507946339 Design\n",
      "1.0 DevOps\n",
      "0.5792667629217116 Dictionary\n",
      "0.37836112445468434 Directories\n",
      "0.4947590262873992 Discounts\n",
      "0.5447384782176198 Documents\n",
      "0.29702839792467406 Domains\n",
      "0.22313016014842973 Drawing\n",
      "1.0 Economics\n",
      "0.22313016014842973 Editing\n",
      "1.0 Education\n",
      "0.9999999999999978 Electronic Signature\n",
      "0.10187021282625373 Email\n",
      "0.33376898370805436 Emergency\n",
      "0.8199336116377213 Energy\n",
      "0.5448701963214639 Engagement\n",
      "0.8587145271160285 England\n",
      "0.4632367951444987 Enterprise\n",
      "0.537373627014392 Entertainment\n",
      "0.8333578931303015 Environment\n",
      "0.2872974951836458 European\n",
      "0.9999999999999973 Events\n",
      "0.32721109064341775 Family\n",
      "0.26146412994911117 Fashion\n",
      "1.0 Fax\n",
      "0.46379481562055863 Feedback\n",
      "0.9035584908021914 Feeds\n",
      "1.0 File Sharing\n",
      "0.8031150520933596 Financial\n",
      "0.8229533737992736 Fitness\n",
      "1.0 Fonts\n",
      "0.9999999999999548 Food\n",
      "0.27706844336610714 Forms\n",
      "0.19914827347145564 Forums\n",
      "0.9799080364605551 French\n",
      "1.0 Funding\n",
      "1.0 Gambling\n",
      "0.7518402356024136 Games\n",
      "1.0 Genealogy\n",
      "0.32905781372191806 Geography\n",
      "0.6031277799520904 German\n",
      "0.7869474231094469 Gifts\n",
      "1.0 Goals\n",
      "0.9999744415963427 Government\n",
      "1.0 Graphics\n",
      "0.809485282519508 Greek\n",
      "0.26502591529736164 Grocery\n",
      "0.3675273597655652 HTML5\n",
      "1.0 Hacking\n",
      "1.0 Hardware\n",
      "0.8787564398231297 Health\n",
      "0.2600399224594337 Healthcare\n",
      "0.766882818819149 History\n",
      "0.8540440105253221 Holidays\n",
      "0.3007082761743609 Home Automation\n",
      "0.2589612561135274 Hosting\n",
      "0.9879358263533058 Hotels\n",
      "0.36726454524660707 Housing\n",
      "0.9732736405258763 Humor\n",
      "0.22313016014842973 Identity\n",
      "0.2833444241018065 Images\n",
      "0.251834597953517 Indian\n",
      "1.0 Intelligence\n",
      "0.21330930508341653 Internet of Things\n",
      "0.23810330555354436 Invoicing\n",
      "0.5987516330675617 Italian\n",
      "1.0 Italy\n",
      "0.9560218784934774 Japanese\n",
      "0.9999983979029936 Jobs\n",
      "0.19914827347145564 Keywords\n",
      "1.0 Korean\n",
      "0.32480217927081273 Language\n",
      "1.0 Law\n",
      "1.0 Learning Management Systems\n",
      "0.24143645097027538 Library\n",
      "0.24227736746379938 Lists\n",
      "0.9999999574666152 Localization\n",
      "0.45565260432241894 Location\n",
      "1.0 Loyalty\n",
      "0.6727152354974312 Lyrics\n",
      "1.0 Machine Learning\n",
      "1.0 Mail\n",
      "1.0 Management\n",
      "1.0 Mapping\n",
      "0.39182348254493976 Marine\n",
      "0.21699536664465466 Marketing\n",
      "0.5142485966574863 Marketplace\n",
      "1.0 Mashups\n",
      "1.0 Math\n",
      "0.2794130478623683 Media\n",
      "0.5874082443319419 Medical\n",
      "0.26146412994911117 Meetings\n",
      "1.0 Meme\n",
      "1.0 Messaging\n",
      "1.0 Metadata\n",
      "0.5898270213105775 Mexican\n",
      "1.0 Mobile\n",
      "1.0 Monetization\n",
      "0.7716493434231607 Monitoring\n",
      "1.0 Mountains\n",
      "0.9999875254108526 Movies\n",
      "0.30621891841327875 Museums\n",
      "1.0 Music\n",
      "0.47394558818631605 Natural Language Processing\n",
      "1.0 Nature\n",
      "0.458346333167874 Networking\n",
      "0.9586445861110039 New York City\n",
      "0.9999999999999843 News Services\n",
      "0.648821534618383 Non-Profit\n",
      "0.2472249099988145 None\n",
      "0.6472318887822313 Nordic\n",
      "1.0 Notes\n",
      "0.9353021135274997 Notifications\n",
      "1.0 Nutrition\n",
      "1.0 OAuth\n",
      "1.0 OCR\n",
      "0.1695245713662267 Office\n",
      "0.31337427753639774 Open Data\n",
      "1.0 Open Source\n",
      "1.0 Optimization\n",
      "1.0 Organization\n",
      "0.705096820723286 PDF\n",
      "1.0 Pakistani\n",
      "1.0 Panorama\n",
      "1.0 Parking\n",
      "1.0 Passports\n",
      "1.0 Patents\n",
      "0.39387551708828394 Payments\n",
      "1.0 Performance\n",
      "0.22696283284780172 Personal Information Management\n",
      "0.19171037663135448 Pets\n",
      "1.0 Photos\n",
      "0.3202287363767992 Plugins\n",
      "0.23810330555354436 Podcasts\n",
      "1.0 Police\n",
      "0.3007082761743609 Politics\n",
      "0.23810330555354436 Polls\n",
      "1.0 Postcards\n",
      "0.4698781977712068 Prices\n",
      "0.5382862397260121 Printing\n",
      "1.0 Privacy\n",
      "0.2872974951836458 Products\n",
      "0.22313016014842982 Profiles\n",
      "0.46990384523183715 Project Management\n",
      "1.0 Prototype\n",
      "0.3706686588112807 Q&A\n",
      "0.5036682742334984 QR Codes\n",
      "1.0 Quantified Self\n",
      "0.5001986183281 Ratings\n",
      "1.0 Real Estate\n",
      "0.4115027381445022 Real Time\n",
      "0.1862929378043001 Recommendations\n",
      "0.6626272662068446 Recreation\n",
      "0.9999969131398012 Reference\n",
      "0.26146412994911117 Refunds\n",
      "0.3044531593776482 Religion\n",
      "0.9948384338791837 Rentals\n",
      "0.3321740137872816 Reporting\n",
      "1.0 Reputation\n",
      "0.3363939795123097 Restaurants\n",
      "0.5784631258316388 SEO\n",
      "0.7173723856778684 Safety\n",
      "0.23810330555354436 Sales\n",
      "1.0 Scheduling\n",
      "0.9562715561485995 Science\n",
      "1.0 Scottish\n",
      "1.0 Search\n",
      "0.3474396682659315 Security\n",
      "0.9103481507063742 Semantics\n",
      "0.4711603120716421 Sentiment\n",
      "0.9999977192822163 Shipping\n",
      "1.0 Social\n",
      "0.2254604595992703 Software-as-a-Service\n",
      "1.0 Solar\n",
      "1.0 Spam\n",
      "0.9982200344852907 Spanish\n",
      "1.0 Sports\n",
      "0.4472536207147937 Spreadsheets\n",
      "0.35761778421082774 Statistics\n",
      "0.26266556067232205 Stocks\n",
      "1.0 Storage\n",
      "0.15845579417975933 Streaming\n",
      "1.0 Subtitles\n",
      "1.0 Summary\n",
      "1.0 Supernatural\n",
      "1.0 Support\n",
      "0.3062189184132777 Surveys\n",
      "0.425112741386006 Sustainability\n",
      "0.6129566695119607 TV\n",
      "0.21330930508341653 Tasks\n",
      "1.0 Taxes\n",
      "1.0 Teleconferencing\n",
      "0.9997372553655388 Telephony\n",
      "0.2650259152973615 Testing\n",
      "0.2650259152973615 Text\n",
      "1.0 Text-to-Speech\n",
      "0.28148987435603234 Tickets\n",
      "0.2872974951836458 Time\n",
      "0.31337427753639774 Time Tracking\n",
      "0.9965649303959254 Tools\n",
      "0.29702839792467445 Tourism\n",
      "1.0 Transcription\n",
      "0.5760802821644381 Translation\n",
      "0.9999986289762086 Transportation\n",
      "1.0 Travel\n",
      "0.31158069893496654 Trivia\n",
      "0.7979262105413485 Tweets\n",
      "0.19914827347145564 URL Shortener\n",
      "1.0 URLs\n",
      "1.0 Validation\n",
      "1.0 Verification\n",
      "1.0 Video\n",
      "0.9844273025867984 Visualizations\n",
      "0.2794130478623685 VoIP\n",
      "0.999999662527204 Voice\n",
      "1.0 Voting\n",
      "0.2872974951836456 Weapons\n",
      "0.9987466450622323 Weather\n",
      "0.8235203170735964 Web Site Management\n",
      "1.0 WebRTC\n",
      "0.6472318887822313 Webcams\n",
      "0.5438131158833297 Weddings\n",
      "0.0619688044166589 Wi-Fi\n",
      "0.9999999998573293 Widgets\n",
      "0.9016265423172547 Wiki\n",
      "0.962581202720767 Wine\n",
      "1.0 Words\n",
      "1.0 Zip Codes\n",
      "0.28656713732126715 eBooks\n",
      "1.0 eCommerce\n"
     ]
    }
   ],
   "source": [
    "from scipy.stats import chi2_contingency\n",
    "import seaborn\n",
    "import matplotlib.pyplot as plt\n",
    "data_ma=get_dataframe(path=\"m-a_edges.csv\")\n",
    "data_ma.columns=[\"name\",\"target\"]\n",
    "data_mashup=get_dataframe(path=\"mashup_nodes_estimator.csv\")\n",
    "data_ma_new=pd.merge(data_ma,data_mashup,on=\"name\")\n",
    "data=data_ma_new[[\"name\",\"target\",\"c\"]].sort_values(\"c\").reset_index(drop=True)\n",
    "data[\"concat\"]=data[\"name\"]+\"==\"+data[\"target\"]\n",
    "data\n",
    "ps=[]\n",
    "cs=[]\n",
    "for c,group in data.groupby(\"c\"):\n",
    "    cs.append(c)\n",
    "    mashup=np.unique(group[\"name\"])\n",
    "    api=np.unique(group[\"target\"])\n",
    "    df=pd.DataFrame(np.zeros((len(mashup),len(api))),index=mashup,columns=api)\n",
    "    concat=np.array(group[\"concat\"])\n",
    "    for line in concat:\n",
    "        m,a=line.split(\"==\")\n",
    "        df.loc[m,a]+=1\n",
    "    p=chi2_contingency(df)\n",
    "    ps.append(p[1])\n",
    "ps=np.array(ps)\n",
    "cs=np.array(cs)\n",
    "for i in range(len(ps)):\n",
    "    print(ps[i],cs[i])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d97c50d2",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
